package com.gombe.credit.app.sdk.dec.util

import android.content.Context
import android.os.Build
import com.gombe.credit.app.sdk.dec.util.GombeCreditUserDecUtils.takeZipString
import org.json.JSONObject

/**
 * hardware
 */
class GombeCreditUserDec3(val context: Context) {

    fun takeUserDec3Data(): String? {
        return try {
           val data = JSONObject().apply {
                put("operatingSystem", "ANDROID")
                put("model", Build.MODEL.toString())
                put("serial", "")
                put("productionDate", Build.TIME.toString())
                put("sdkVersion", Build.VERSION.SDK_INT.toString())
                put("phoneType", GombeCreditUserDecUtils.takeDec3Params2(context))
                put("versionCode", GombeCreditUserDecUtils.takeDec3Params11(context))
                put("versionName", GombeCreditUserDecUtils.takeDec3Params10(context))
                put("androidId", GombeCreditUserDecUtils.takeDec3Params1(context))
                put("telephony", GombeCreditUserDecUtils.takeDec1AndDec3Params3(context))
                put("isVpn", GombeCreditUserDecUtils.takeDec3Params19(context))
                put("isProxyPort", GombeCreditUserDecUtils.takeDec3Params20())
                put("isDebug", GombeCreditUserDecUtils.takeDec3Params7(context))
                put("simState", GombeCreditUserDecUtils.takeDec3Params12(context))
                put("root", GombeCreditUserDecUtils.takeDec3Params14())
                put("physicalSize", GombeCreditUserDecUtils.takeDec3Params18(context))
                put("displayLanguage", GombeCreditUserDecUtils.takeDec3Params3())
                put("iso3Language", GombeCreditUserDecUtils.takeDec3Params4())
                put("iso3Country", GombeCreditUserDecUtils.takeDec3Params5())
                put("networkOperatorName", GombeCreditUserDecUtils.takeDec1AndDec3Params3(context))
                put("networkType", GombeCreditUserDecUtils.takeDec1AndDec3Params2(context))
                put("timeZoneId", GombeCreditUserDecUtils.takeDec3Params6())
                put("elapsedRealtime", GombeCreditUserDecUtils.takeDec3Params8())
                put("sensorList", GombeCreditUserDecUtils.takeDec3Params13(context))
                put("lastBootTime", GombeCreditUserDecUtils.takeDec3Params9())
                put("rootJailbreak", GombeCreditUserDecUtils.takeDec3Params14())
                put("keyboard", GombeCreditUserDecUtils.takeDec3Params15(context))
                put("isSimulator", GombeCreditUserDecUtils.takeDec3Params16())
                put("dbm", GombeCreditUserDecUtils.takeDec3Params17(context)) //
                put("phoneNumber", "")
            }
            data.toString().takeZipString()
        } catch (e: java.lang.Exception) {
            null
        }
    }
}